#!/usr/bin/env bash

set -e
CODE_PATH=`pwd`

PEM_PATH=~/Documents/workspace/cs5.pem

IP=172.18.180.228
USER=work
DEPLOY_PATH=/home/work/apps/airflow/apps/mongodb_dump

echo "当前更新代码路径: ${CODE_PATH}"


for item in `ls`
do
    if [ "${item}" = "deploy.sh" ]; then
        continue
    fi

    if [ -d ${item} ];then
        echo "当前文件是文件夹，不进行部署: ${item}"
        continue
    fi

    scp -i ${PEM_PATH} ${item} ${USER}@${IP}:${DEPLOY_PATH}
    echo "当前部署完成脚本: ${DEPLOY_PATH}/${item}"
done
echo "代码更新完成"